
<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <!-- 上述3个meta标签*必须*放在最前面，任何其他内容都*必须*跟随其后！ -->
    <meta name="description" content="">
    <meta name="author" content="">

    <title>后台</title>

    <link href="__PUBLIC__/images/favicon.ico" rel="shortcut icon" />

    <!-- Bootstrap core CSS -->
    <link rel="stylesheet" href="__PUBLIC__/css/bootstrap.min.css" />
    <link rel="stylesheet" href="__PUBLIC__/css/bootstrap-theme.min.css" />
    <link rel="stylesheet" href="__PUBLIC__/css/dashboard.css" />
    <link rel="stylesheet" href="__PUBLIC__/css/bootstrap-switch.css" />
    <link rel="stylesheet" href="__PUBLIC__/css/icheck/all.css" />
    <link rel="stylesheet" href="__PUBLIC__/css/bootstrap-datetimepicker.css" />

</head>

<body>

<include file="Common/topNav" />

<div class="container-fluid">
    <div class="row">
        <include file="Common/leftMenu" />
        <div class="col-sm-9 col-sm-offset-3 col-md-10 col-md-offset-2 main">
        	<!--标题头-->
            <div class="cont-title clearfix">
                <div class="title">企业工商管理信息</div>
            	<div class="btn-group">
                    <if condition="$Think.session.default_module == 'Building'">
                	    <button type="button" id="load"  class="btn">一键导入</button>
                    </if>
                	<button type="button" id="companyAdd"  class="btn">添加</button>
                	<!--<button type="button" id="delCompany"  class="btn">删除</button>-->
                </div>
            </div>
            <!--搜索模块-->
        	<form class="jc-search form-inline searchForm" method="post" action="{:U('Admin/Company/index')}" id="searchForm">
                <if condition="$Think.session.default_module == 'Building'">
                    <div class="form-group">
                        <label>所属商圈:</label>
                        <select class="form-control" name="trade_id">
                            <option value="" <if condition="$trade_id eq ''">selected</if>>全部</option>
                            <foreach name="tradeList" item="trade">
                                <option value="{$trade.id}" <if condition="$trade.id eq $trade_id">selected</if>>{$trade.name}</option>
                            </foreach>
                        </select>
                    </div>
                    <div class="form-group">
                        <label>街道 :</label>
                        <select class="form-control" name="org_id" >
                            <volist name="orgs" id="item">
                                <option  value="{$item.id}" <if condition="$orgId eq $item['id']">selected="selected"</if> >{$item.name} </option>
                            </volist>
                        </select>
                    </div>
                    <div class="form-group">
                        <label>楼宇 :</label>
                        <select class="form-control" name="house_id">
                            <option value="" >全部</option>
                            <volist name="houses" id="item">
                                <option <if condition="$houseId eq $item['id']">selected="selected"</if> value="{$item.id}">{$item.name}</option>
                            </volist>
                        </select>
                    </div>
                </if>
                <if condition="$Think.session.default_module == 'Space'">
                    <div class="form-group">
                        <label>所属空间:</label>
                        <select class="form-control" name="space_id">
                            <option value="" <if condition="$space_id eq ''">selected</if>>全部</option>
                            <foreach name="spaceList" item="space">
                                <option value="{$space.id}" <if condition="$space_id eq $space['id']">selected</if>>{$space.name}</option>
                            </foreach>
                        </select>
                    </div>
                </if>
                <div class="form-group">
                    <label>经营状态:</label>
                    <select class="form-control" name="status">
                        <option value="" >全部</option>
                        <option value="1" <if condition="$status eq '1'">selected</if>>正常户</option>
                        <option value="2" <if condition="$status eq '2'">selected</if>>疑似户</option>
                        <option value="3" <if condition="$status eq '3'">selected</if>>空挂户</option>
                    </select>
                </div>
                <div class="form-group">
                    <label>企业类别:</label>
                    <select class="form-control" name="type">
                        <option value="" >全部</option>
                        <option value="1" <if condition="$type eq '1'">selected</if>>公司</option>
                        <option value="2" <if condition="$type eq '2'">selected</if>>分公司</option>
                        <option value="3" <if condition="$type eq '3'">selected</if>>办事处</option>
                        <option value="4" <if condition="$type eq '4'">selected</if>>个体</option>
                        <option value="5" <if condition="$type eq '5'">selected</if>>无照</option>
                        <option value="6" <if condition="$type eq '6'">selected</if>>在办</option>
                        <option value="7" <if condition="$type eq '7'">selected</if>>其他</option>
                    </select>
                </div>
                <div class="form-group">
                    <label>入驻状态:</label>
                    <select class="form-control" name="enter_status">
                        <option value="" >全部</option>
                        <option value="1" <if condition="$enter_status eq '1'">selected</if>>已入驻</option>
                        <option value="2" <if condition="$enter_status eq '2'">selected</if>>已离开</option>
                    </select>
                </div>
                <div class="form-group">
                	<label>关键字 :</label>
                    <input type="text" class="form-control" name="keywords" value="{$_POST['keywords']}" placeholder=" 输入企业名称、注册号 ">
                </div>
                <button type="button" id="search" class="btn">搜索</button>
            </form>
            <!--表格-->
            <div class="table-responsive">
                <table class="table table-striped table-hover" id="tableData">
                    <thead>
                    <tr>
                        <th>序号</th>
                        <if condition="$Think.session.default_module == 'Space'">
                            <th>所属空间</th>
                        </if>
                        <th>企业名称</th>
                        <th>企业注册码</th>
                        <th>法定代表人</th>
                        <th>成立时间</th>
                        <th>企业类别</th>
                        <th>入驻状态</th>
                        <th>经营状态</th>
                        <th>操作</th>
                    </tr>
                    </thead>
                    <tbody>
                    <volist name="companyList['list']" id="company">
                        <tr>
                            <td>{$key|getLineNum=$nowPage,$pageSize}</td>
                            <if condition="$Think.session.default_module == 'Space'">
                                <td>{$company.space.name}</td>
                            </if>
                            <td>{$company.name}</td>
                            <td>{$company.registration_mark}</td>
                            <td>{$company.legal_person}</td>
                            <if condition="$company['registration_time'] eq '0'">
                                <td></td>
                            <else/>
                                <td>{$company.registration_time|date='Y-m-d',###}</td>
                            </if>
                            <td>
                              <if condition="$company.type eq 1">公司
                                    <elseif condition="$company.type eq 2"/>分公司
                                    <elseif condition="$company.type eq 3"/>办事处
                                    <elseif condition="$company.type eq 4"/>个体
                                    <elseif condition="$company.type eq 5"/>无照
                                    <elseif condition="$company.type eq 6"/>在办
                                    <else/>其他
                                </if>
                            </td>
                            <td>
                                <if condition="$company.enter_status eq 1">
                                    <span class="label label-success">已入驻</span>
                                    <elseif condition="$company.enter_status eq 2"/>
                                    <span class="label label-warning">已离开</span>
                                    <else/>
                                    <span class="label label-danger">未知</span>
                                </if>
                            </td>
                            <td>
                                <if condition="$company.status eq 1">
                                    <span class="label label-success">正常户</span>
                                <elseif condition="$company.status eq 2"/>
                                    <span class="label label-warning">疑似户</span>
                                <else/>
                                    <span class="label label-danger" title="{$meetOrder.reason}">空挂户</span>
                                </if>
                            </td>
                            <td>
                                <a href="javascript:void(0)" companyId="{$company.id}" class="detailCompany">详情</a> |
                                <a href="javascript:void(0)" companyId="{$company.id}" class="editCompany">修改</a> |
                                <a href="javascript:void(0)" companyId="{$company.id}" class="delCompany">删除</a>
                            </td>
                        </tr>
                    </volist>
                    </tbody>
                </table>
                <div class="page">
                	{$companyList.page}
                </div>
            </div>
	           
        </div>
    </div>
</div>
<include file="Common/modalHtmls" />
<script type="text/javascript" src="__PUBLIC__/js/jquery.min.js"></script>
<script type="text/javascript" src="__PUBLIC__/js/bootstrap.min.js"></script>
<script type="text/javascript" src="__PUBLIC__/js/bootstrap-switch.js"></script>
<script type="text/javascript" src="__PUBLIC__/js/icheck.min.js"></script>
<script type="text/javascript" src="__PUBLIC__/js/common.js"></script>
<script type="text/javascript" src="__PUBLIC__/js/bootstrap-datetimepicker.js"></script>
<script type="text/javascript" src="__PUBLIC__/js/validator.min.js"></script>

<script type="text/javascript" src="__PUBLIC__/js/jquery-upload/js/vendor/jquery.ui.widget.js"></script>
<script type="text/javascript" src="__PUBLIC__/js/jquery-upload/js/jquery.fileupload.js"></script>
<script type="text/javascript" src="__PUBLIC__/js/jquery-upload/js/jquery.fileupload-ui.js"></script>
<script type="text/javascript" src="__PUBLIC__/js/jquery-upload/js/jquery.iframe-transport.js"></script>
<script type="text/javascript" src="__PUBLIC__/js/jquery-upload/js/jquery.fileupload-process.js"></script>
<script>
    $("#tableData .editCompany").click(function () {
        var companyId = $(this).attr("companyId");
        common.htmlAjax("{:U('Admin/Company/editCompany')}", {companyId: companyId}, function (html) {
            $("#commonModal").html(html).modal({show: true, backdrop: 'static', keyboard: false});
        })
    })

    $("#companyAdd").click(function () {
        common.htmlAjax("{:U('Admin/Company/addCompany')}", {}, function (html) {
            $("#commonModal").html(html).modal({show: true, backdrop: 'static', keyboard: false});
        })
    })

    $("#tableData .delCompany").click(function(){
        var companyId = $(this).attr("companyId");
        common.confirm("提示","确定删除该企业信息?",function(){
            common.ajax("{:U('Admin/Company/delCompany')}",{companyId:companyId},function(data){
                common.alert("提示","企业信息删除成功!",function(){
                    common.reload();
                });
            })
        })
    });
    $("#tableData .detailCompany").click(function () {
        var companyId = $(this).attr("companyId");
        common.htmlAjax("{:U('Admin/Company/info')}", {companyId: companyId}, function (html) {
            $("#commonModal").html(html).modal({show: true, backdrop: 'static', keyboard: false});
        })
    })

    $("#search").click(function () {
        $('#searchForm').submit()
    })


   $("#load").click(function () {
        common.htmlAjax("{:U('Admin/Company/load')}", {}, function (html) {
            $("#commonModal").html(html).modal({show: true, backdrop: 'static', keyboard: false});
        })
    })

</script>
</body>
</html>
